var express = require('express');
var router = express.Router();
const { getOrders,getOneOrder,updateOrders,deleteOrders } = require('../service/ordersService');

//渲染和查询
router.get('/getOrders', async function (req, res, next) {
  let data = await getOrders(req.query);  
    res.send(data);
  });
//根据id查找一个订单的信息
router.post('/getOneOrder', async function (req, res, next) {     
  let data = await getOneOrder(req.body);
    res.send(data);
    //console.log(data);
    
  });
//修改订单数据
router.post('/updateOrders', async function (req, res, next) {     
  let data = await updateOrders(req.body);
    res.send(data);
    
  });
//删除订单
router.post('/deleteOrders', async function (req, res, next) {           
   let data = await deleteOrders(req.body);
     res.send(data);
    
  });

module.exports = router;
